﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BUS;
using DTO;

namespace GIAODIEN
{
    public partial class frmtimkiem : Form
    {
        public frmtimkiem()
        {
            InitializeComponent();
        }
        BUS_DocGia busDocGia = new BUS_DocGia();
        BUS_Sach busSach = new BUS_Sach();
        BUS_nhanvien busNhanVien = new BUS_nhanvien();
        BUS_TacGia busTacGia = new BUS_TacGia();
        private void frmtimkiem_Load(object sender, EventArgs e)
        {
            bientoancuc.timkiem = 1;
            cbobang.SelectedIndex = 0;
        }

        private void frmtimkiem_FormClosing(object sender, FormClosingEventArgs e)
        {
            bientoancuc.timkiem = 0;
        }

        private void cbobang_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cbobang.SelectedIndex) {
                case 0: {
                    dtgvhienthi.DataSource = busDocGia.LayDSDocGia();
                    break;
                }

                case 1: {
                    dtgvhienthi.DataSource = BUS_Sach.laysach();
                    break;
                }
                case 2: {
                    dtgvhienthi.DataSource = BUS_TacGia.laytacgia();
                    break;
                }
                case 3: {
                    dtgvhienthi.DataSource = BUS_nhanvien.LayDSNhanVien();
                    break;
                }
            }
        }
    }
}
